<template>
    <a-menu :mode="models" :theme="theme" :items="menuList" @select="selectMenu" />
</template>

<script>
import Emitt from '@/utils/mitt'
export default {
    data() {
        return {
            models: 'inline',
            theme: 'dark',
            menuList: [
                // {
                //     label: '仪表盘',
                //     key: '/dashboard',
                //     children: [
                //         {
                //             label: this.$t(`message.analysis`),
                //             key: '/dashboard/analysis',
                //         },
                //         {
                //             label: this.$t(`message.workplace`),
                //             key: '/dashboard/workplace'
                //         },
                //     ]
                // },
                // {
                //     label: '错误页',
                //     key: '/error',
                //     children: [
                //         {
                //             label: '403',
                //             key: '/403'
                //         },
                //         {
                //             label: '404',
                //             key: '/404'
                //         },
                //     ]
                // }
                {
                    label: this.$t(`message.dashboard`),
                    key: '/dashboard',
                    children: [
                        {
                            label: this.$t(`message.analysis`),
                            key: '/dashboard/analysis',
                        },
                        {
                            label: this.$t(`message.workplace`),
                            key: '/dashboard/workplace'
                        },
                    ]
                },
                {
                    label: this.$t(`message.error`),
                    key: '/error',
                    children: [
                        {
                            label: '403',
                            key: '/403'
                        },
                        {
                            label: '404',
                            key: '/404'
                        },
                    ]
                },
                {
                    label:this.$t(`message.formItemProps`),
                    key:'/formItemProps',
                }

            ]
        }
    },
    created() {
        Emitt.on('settings', (data) => {
            this.theme = data.navTheme
        })
    },
    props: ['model'],
    mounted() {
        this.models = this.model
        console.log(this.models)
        const setting = JSON.parse(localStorage.getItem('themes'))
        if (setting) {
            this.theme = setting.navTheme
        }
    },
    methods: {
        selectMenu(item) {
            this.$router.push({ path: item.key })
        },
    },
}
</script>

<style></style>